package com.example.demo.cardemo;

public class CarIoc {
    public static void main(String[] args) {
        Tire tire = new Tire(19);
        Bottom bottom = new Bottom(tire);
        Framework framework = new Framework(bottom);

        Car car = new Car(framework);

    }
    static class Car{

        private Framework framework;
        public Car(Framework framework){
            this.framework = framework;
            System.out.println("car init....");
        }

    }

    static class Framework{
        private Bottom bottom;
        public Framework(Bottom bottom){
            this.bottom = bottom;
            System.out.println("framework init....");
        }
    }

    static class Bottom{
        private Tire tire;
        public Bottom(Tire tire){//造地盘直接用现成的tire
            this.tire = tire;
            System.out.println("bottom init...");
        }
    }

    static class Tire{
        private int tire;
        public Tire(int size){
            System.out.println("tire init...."+size);
        }
    }
}
